Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generator and add endpoint proxies/patches for backward compatibility #204

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

saimedhi
Copy link
Collaborator

@saimedhi saimedhi commented Jul 3, 2024

Description

  • Fix generator and add endpoint proxies/patches for backward compatibility.
  • Generated code can be seen here
  • I will raise subsequent PRs to merge the generated code, addressing a few namespaces at a time.

Issues Resolved

Closes #97

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -48,6 +48,12 @@ public function renderClass(): string
$class = file_get_contents(self::CLIENT_CLASS_TEMPLATE);
// use Namespace
$useNamespace = '';

// The following namespaces do not have OpenSearch API specifications
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this kind of stuff should be data-driven, e.g. with a folder structure ssl/something.yaml.


// Set the HTTP method
$action = $this->getMethod();
if ($action === ['POST', 'PUT'] && $this->getClassName() !== 'Bulk') {
$method = "'PUT'";
} elseif (!empty($this->content['body']) && ($action === ['GET', 'POST'] || $action === ['POST', 'GET'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can sort $action instead of the check, which will work better if you need to add another method (combinations of 3 are harder :)).

@dblock dblock merged commit 96580eb into opensearch-project:main Jul 8, 2024
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] New API Client generated from spec
2 participants